﻿using System;
using Autodesk.Revit.DB;

namespace YJKFamilyFindder.YJKFamilyFindder
{
	public class ElementInfo
	{
		public string Id
		{
			get
			{
				return this.m_Id;
			}
		}

		public string TheCategory
		{
			get
			{
				return this.m_Category;
			}
		}

		public string TheFamily
		{
			get
			{
				return this.m_Family;
			}
		}

		public string TheFamilySymbol
		{
			get
			{
				return this.m_FamilySymbol;
			}
		}

		public ElementInfo(ElementInfo rhs)
		{
			this.m_Id = rhs.m_Id;
			this.m_Category = rhs.m_Category;
			this.m_Family = rhs.m_Family;
			this.m_FamilySymbol = rhs.m_FamilySymbol;
		}

		public ElementInfo(string id, string category, string family, string familySymbol)
		{
			this.m_Id = id;
			this.m_Category = category;
			this.m_Family = family;
			this.m_FamilySymbol = familySymbol;
		}

		public ElementInfo(Element element, Autodesk.Revit.DB.Document doc)
		{
			this.m_Id = element.Id.IntegerValue.ToString();
			this.m_Category = "";
			if (element.Category != null)
			{
				this.m_Category = element.Category.Name;
			}
			this.m_Family = "";
			this.m_FamilySymbol = "";
			if (element.GetType() == typeof(FamilyInstance))
			{
				FamilyInstance familyInstance = element as FamilyInstance;
				this.m_Family = familyInstance.Symbol.Family.Name;
				this.m_FamilySymbol = familyInstance.Symbol.Name;
				return;
			}
			this.m_Family = element.GetType().FullName;
			ElementId typeId = element.GetTypeId();
			Element element2 = doc.GetElement(typeId);
			this.m_FamilySymbol = element2.Name;
		}

		private string m_Id;

		private string m_Category;

		private string m_Family;

		private string m_FamilySymbol;
	}
}
